

*** for each outcome, run a regression model and calculate the significance of difference intervals 


***length of speech
* load data
import delimited "Full Replication Files\Data\tab1.csv"
* recode variables
generate lnlength = ln(length+1)
encode scale, gen(scale_b)
* regress speech length on race, scale, scenario
reg lnlength i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
* calculate predictions by race
margins white, atmeans post

* calculate mean, variance, covariance of predictions
tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

* calculate significance of difference intervals
sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff


*** total mentions (any preference)
clear

import delimited "Full Replication Files\Data\tab1.csv"
generate lnprefmens = ln(total_pref_mentions+1)
encode scale, gen(scale_b)

reg lnprefmens i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff


*** first turn
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace first_turn = "" if first_turn =="NA"
destring first_turn, replace
generate lnfirst_turn = ln(first_turn+1)*-1
encode scale, gen(scale_b)

reg lnfirst_turn i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)*-1) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)*-1) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff

*** last turn
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace last_turn = "" if last_turn =="NA"
destring last_turn, replace
replace total_turns = "" if total_turns =="NA"
destring total_turns, replace
generate lnlast_turn = ln(total_turns - last_turn+1)*-1
encode scale, gen(scale_b)

reg lnlast_turn i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)*-1) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)*-1) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff

*** own mentions 
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace own_pref_mentions = "" if own_pref_mentions =="NA"
destring own_pref_mentions, replace
generate lnown_pref_mentions = ln(own_pref_mentions+1)
encode scale, gen(scale_b)

reg lnown_pref_mentions i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff

*** other mentions 
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace other_pref_mentions = "" if other_pref_mentions =="NA"
destring other_pref_mentions, replace
generate lnother_pref_mentions = ln(other_pref_mentions+1)
encode scale, gen(scale_b)

reg lnother_pref_mentions i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff

*** fore mentions 
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace fore_pref_mentions = "" if fore_pref_mentions =="NA"
destring fore_pref_mentions, replace
generate lnfore_pref_mentions = ln(fore_pref_mentions+1)
encode scale, gen(scale_b)

reg lnfore_pref_mentions i.white scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff

*** total mentions 
clear

import delimited "Full Replication Files\Data\tab2.csv"
replace pref_mentions = "" if pref_mentions =="NA"
destring pref_mentions, replace
generate lnpref_mentions = ln(pref_mentions+1)
encode scale, gen(scale_b)
encode whites_cat, gen(whites_cat_b)

reg lnpref_mentions i.white#i.whites_cat_b scale_b i.scenario if round==1, cluster(jurynum)
margins white#whites_cat_b, atmeans

reg lnpref_mentions i.white scale_b i.scenario if round==1, cluster(jurynum)
margins white, atmeans post

tempname m1 s1 m2 s2 cor12
scalar `m1' = exp(el(r(b),1,1)) * (1 + el(r(V),1,1)/2)
scalar `s1' = sqrt(el(r(V),1,1)) * `m1'
scalar `m2' = exp(el(r(b),1,2)) * (1 + el(r(V),2,2)/2)
scalar `s2' = sqrt(el(r(V),2,2)) * `m2'
scalar `cor12' = el(r(V),2,1)/(sqrt(el(r(V),1,1))*sqrt(el(r(V),2,2)))

sdii, sample1(`=`m1'' `=`s1'') sample2(`=`m2'' `=`s2'') corr(`=`cor12'') diff


*** other mentions with interaction
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace other_pref_mentions = "" if other_pref_mentions =="NA"
destring other_pref_mentions, replace
replace num_others_pref = "" if num_others_pref =="NA"
destring num_others_pref, replace
generate lnother_pref_mentions = ln(other_pref_mentions+1)
encode scale, gen(scale_b)
encode distance_b, gen(distance_bb)

reg lnother_pref_mentions i.white#i.distance_bb num_others_pref scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white#distance_bb, atmeans post

*** fore mentions with interaction
clear

import delimited "Full Replication Files\Data\tab1.csv"
replace fore_pref_mentions = "" if fore_pref_mentions =="NA"
destring fore_pref_mentions, replace
replace num_others_pref = "" if num_others_pref =="NA"
destring num_others_pref, replace
generate lnfore_pref_mentions = ln(fore_pref_mentions+1)
encode scale, gen(scale_b)
encode distance_b, gen(distance_bb)

reg lnfore_pref_mentions i.white#i.distance_bb num_others_pref scale_b i.scenario if round==1&jury_prop_words_attributed>.8, cluster(jurynum)
margins white#distance_bb, atmeans post


